<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
    <style>
        .swiper-container {
            width: 600px;
            height: 300px;
        }
        .swiper-pagination-bullet {
            width: 20px;
            height: 20px;
            text-align: center;
            line-height: 20px;
            font-size: 12px;
            color: #000;
            opacity: 1;
            background: rgba(0,0,0,0.2);
        }
        .my-bullet-active{
            background: #ff6600;
            opacity: 1;
        }
    </style>
</head>

<body>

    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
    </div>
    <!-- 导航等组件可以放在container之外 -->

    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"> </script>
    <script>
        var mySwiper = new Swiper('.swiper-container', {
            loop: true, // 循环模式选项

            // 如果需要分页器
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
                bulletActiveClass: 'my-bullet-active',
                className: 'swiper-pagination-bullet',
                // renderBullet: function (index, className) {
                //     return '<span class="' + className + '">' + (index + 1) + '</span>';
                // },
                renderBullet: function (index, className) {
                    switch(index){
                        case 0:text='壹';break;
                        case 1:text='贰';break;
                        case 2:text='叁';break;
                        case 3:text='肆';break;
                        case 4:text='伍';break;
                    }
                    return '<span class="' + className + '">' + text + '</span>';
                },
            },

            // 如果需要前进后退按钮
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            }
        })
        //鼠标滑过pagination控制swiper切换       
    </script>
</body>

</html>